package com.liy.cloud.common.pw.service.impl;

import com.liy.cloud.common.pw.dao.PwAccountListDao;
import com.liy.cloud.common.pw.entity.PwAccountListEntity;
import com.liy.cloud.common.pw.service.PwAccountListService;
import com.das.framework.common.dao.IBaseDao;
import com.das.framework.common.service.impl.BaseServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: liyang
 * @Date: 2018/6/19 19:18
 **/
@Service
public class PwAccountListServiceImpl extends BaseServiceImpl<PwAccountListEntity, String> implements PwAccountListService {

    @Autowired
    PwAccountListDao accountListDao;

    @Override
    public IBaseDao<PwAccountListEntity, String> getDao() {
        return accountListDao;
    }

    /*
     * @Author:  liyang
     * @Date:    2018/6/25  17:36
     * @Description: 批量更新
     *
     **/
    @Override
    public void updateBatch(List<PwAccountListEntity> list) {
        for (PwAccountListEntity entity : list) {
            accountListDao.updateByPrimaryKeySelective(entity);
        }
    }

    /*
    * @Author:  liyang
    * @Date:    2018/6/28  10:36
    * @Description: 批量新增
    *
    **/
    @Override
    public void addNewBatch(List<PwAccountListEntity> list) {
        for (PwAccountListEntity entity : list) {
            accountListDao.insertSelective(entity);
        }
    }

    /*
     * @Author:  liyang
     * @Date:    2018/6/29  10:00
     * @Description: 根据AccountId 精准查询 明细list 不分页
     *
     **/
    @Override
    public List<PwAccountListEntity> getListByAccountId(String accountId) {
        return accountListDao.getListByAccountId(accountId);
    }

    @Override
    public PwAccountListEntity getListByDeviceIdAndTime(PwAccountListEntity entity) {
        return accountListDao.getListByDeviceIdAndTime(entity);
    }

    /*
     * @Author:  libs
     * @Date:    2018/8/1  9:32
     * @Description: 查询某运营日内的明细信息，必传字段：1.车站编号 systemId 2.单据类型 type 3.单据状态 tempField 4.审核日期 createDate
     * @Params：listEntity 查询条件
     *
     **/
    @Override
    public List<PwAccountListEntity> getOneDayList(PwAccountListEntity listEntity){
        return accountListDao.selectOneDayList(listEntity);
    }
}
